<?php

namespace Addons\userIndex;
use Common\Controller\Addon;

/**
 * 我的信息插件
 * @author 无名
 */

    class userIndexAddon extends Addon{

        public $info = array(
            'name'=>'userIndex',
            'title'=>'我的信息',
            'description'=>'首页用户信息',
            'status'=>1,
            'author'=>'无名',
            'version'=>'0.1'
        );

        public function install(){
            return true;
        }

        public function uninstall(){
            return true;
        }

        //实现的AdminIndex钩子方法
        public function AdminIndex($param){
            $config = $this->getConfig();
            $this->assign('addons_config', $config);
            $userinfo =M('member')->find(UID);
            $map['uid'] = UID;
            $mapa['uid'] = intval(is_login());
            $group = M('AuthGroupAccess')->where($mapa)->find();
            if(intval(is_login()) == 1 || $group['group_id'] == 4){
                $kaka = 0;
            } else {
                $kaka = 1;
            }
            // $map['money'] = array('lt', 0);
            // $userinfo['sumjf']=M('list')->where($map)->sum('money');
            $re = M('Member')->where($map)->find();
            $userinfo['sumjf'] = $re['total_money'];
            $this->assign('userinfo', $userinfo);
            $this->assign('kaka', $kaka);
            if($config['display'])
                $this->display('widget');   
        }

    }